{extend name="web/public/base" /}
{block name="header"}
{/block}
{block name="main"}
<section class="scrollable padder">
    <ul class="breadcrumb no-border no-radius b-b b-light pull-in">
        <li><a><i class="fa fa-home"></i> 首页</a></li>
        <li class="active">会员管理</li>
        <li class="active">{$title}</li>
    </ul>
    <div class="row">
        <div class="col-sm-12">
            <section class="panel panel-default">
                <header class="panel-heading font-bold">{$title}</header>
                <div class="panel-body">
                    <form id="ajaxform" action="{:url('registerAdmin')}" method="post" onsubmit="return false;">
                        <div class="row col-md-12">
                            <div class="form-group col-sm-6">
                                <label>会员账号</label>
                                <input type="text" id="usernumber" name="usernumber" class="form-control"
                                       placeholder="会员账号" value="{$userinfo['usernumber']}">
                            </div>
                            <div class="form-group col-sm-6">
                                <label>会员姓名</label>
                                <input type="text" id="realname" name="realname" class="form-control"
                                       placeholder="会员姓名">
                            </div>
                        </div>
                        <div class="row col-md-12">

                            <div class="form-group col-sm-6">
                                <label>手机号</label>
                                <input type="text" id="mobile" name="mobile" class="form-control" placeholder="手机号">
                            </div>
                            <!--<div class="form-group col-sm-6">-->
                                <!--<label>身份证号</label>-->
                                <!--<input type="text" id="IDcard" name="IDcard" class="form-control" placeholder="身份证号">-->
                            <!--</div>-->
                        </div>
                        <!--<div class="row col-md-12">-->
                            <!--<div class="form-group col-sm-6">-->
                                <!--<label>所在地区</label><br>-->
                                <!--<select name="province" id="province" class="form-control" style="width: 30%;display: inline-block">-->
                                    <!--<option value="" class="province">&#45;&#45;选择省&#45;&#45;</option>-->
                                <!--</select>-->
                                <!--<select name="city" id="city" class="form-control" style="width: 30%;display: inline-block">-->
                                    <!--<option value="" class="city">&#45;&#45;选择市&#45;&#45;</option>-->
                                <!--</select>-->
                                <!--<select name="district" id="district" class="form-control" style="width: 30%;display: inline-block">-->
                                    <!--<option value="" class="district">&#45;&#45;选择县、区&#45;&#45;</option>-->
                                <!--</select>-->
                            <!--</div>-->
                            <!--<div class="form-group col-sm-6">-->
                                <!--<label>详细地址</label>-->
                                <!--<input type="text" placeholder="请输入详细地址" name="address" class="form-control"/>-->
                            <!--</div>-->
                        <!--</div>-->
                        <!--<div class="row col-lg-12">-->
                            <!--<div class="form-group col-sm-6">-->
                                <!--<label>开户银行</label>-->
                                <!--<select class="form-control" name="bankname">-->
                                    <!--{foreach name="allow_bank" item="vo"}-->
                                    <!--<option value="{$vo}">{$vo}</option>-->
                                    <!--{/foreach}-->
                                <!--</select>-->
                            <!--</div>-->
                            <!--<div class="form-group col-sm-6">-->
                                <!--<label>银行卡号</label>-->
                                <!--<input type="text" id="banknumber" name="banknumber" class="form-control"-->
                                       <!--placeholder="银行卡号">-->
                            <!--</div>-->
                        <!--</div>-->
                        {notempty name="table"}
                        <div class="form-group ">
                            <div class="line line-dashed col-sm-12"></div>
                        </div>
                        <div class="row col-lg-12">
                            <div class="form-group col-sm-6">
                                <label>推荐人账号</label>
                                <input type="text" name="tuijiannumber" class="form-control" placeholder="推荐人账号"
                                       value="{$userinfo['tuijiannumber']}">
                            </div>
                        </div>
                        {/notempty}
                        <div class="form-group ">
                            <div class="line line-dashed col-sm-12"></div>
                        </div>
                        <div class="row col-lg-12">
                            <div class="form-group col-sm-6">
                                <label>登录密码(111111)</label>
                                <input type="password" id="password1" name="password1" class="form-control"
                                       placeholder="登录密码"
                                       value="111111">
                            </div>
                            <div class="form-group col-sm-6">
                                <label>确认登录密码(111111)</label>
                                <input type="password" id="repassword1" name="repassword1" class="form-control"
                                       placeholder="确认登录密码"
                                       value="111111">
                            </div>
                        </div>
                        <div class="row col-lg-12">
                            <div class="form-group col-sm-6">
                                <label>提现密码(111111)</label>
                                <input type="password" id="password2" name="password2" class="form-control"
                                       placeholder="提现密码"
                                       value="111111">
                            </div>
                            <div class="form-group col-sm-6">
                                <label>确认提现密码(111111)</label>
                                <input type="password" id="repassword2" name="repassword2" class="form-control"
                                       placeholder="确认提现密码"
                                       value="111111">
                            </div>
                        </div>

                        <footer class="panel-footer text-right bg-light lter col-sm-12">
                            <button type="submit" class="btn btn-success btn-s-xs">提 交</button>
                        </footer>
                    </form>
                </div>
            </section>
        </div>

    </div>
</section>
{/block}
{block name="script"}
<script src="__PUBLIC__/area.js"></script>
<script>
    $(function () {
        $.validator.setDefaults({
            submitHandler: function () {
                ajaxSubmit();
            },
            highlight: function (element, errorClass) {
                $(element).css('border', '2px solid red');
            },
            unhighlight: function (element, errorClass) {
                $(element).css('border', '1px solid green');
            }
        });

//        jQuery.validator.addMethod("isMobile", function (value, element) {
//            var length = value.length;
//            var mobile = /^(((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(16[0-9]{1})|(17[0-9]{1})|(18[0-9]{1})|(19[0-9]{1}))+\d{8})$/;
//            return this.optional(element) || (length == 11 && mobile.test(value));
//        }, "请正确填写您的手机号码");

        $.validator.addMethod("checkPwd", function (value, element, params) {
            var checkPwd = /^\w{6,16}$/g;
            return this.optional(element) || (checkPwd.test(value));
        }, "*只允许6-16位英文字母、数字或者下画线！");

        $('#ajaxform').validate({
            rules: {
                usernumber: {
                    required: true,
                    remote: {
                        type: "post",
                        url: "{:url('checkusernum')}",
                        data: {
                            usernumber: function () {
                                return $("#usernumber").val();
                            }
                        },
                        dataType: "json",
                        dataFilter: function (data, type) {
                            return data;
                        }
                    }
                },
                realname: "required",
                mobile: {
                    required: true
//                    isMobile: true
                },
//                IDcard: {
//                    required: true,
//                    rangelength: [18, 18]
//                },
//                banknumber: {
//                    required: true,
////                    creditcard: true
//                },
                password1: {
                    checkPwd: true
                },
                repassword1: {
                    equalTo: "#password1"
                },
                password2: {
                    checkPwd: true
                },
                repassword2: {
                    equalTo: "#password1"
                }
            },
            messages: {
                usernumber: {
                    required: "请输入会员账号",
                    remote: "该编号已存在"
                },
                realname: "请输入会员姓名",
                mobile: "请输入正确的手机号码",
//                IDcard: "请输入18位身份证号码",
//                banknumber: "请输入银行卡号码",
                password1: "请输入一个正确的登录密码",
                repassword1: "确认登录密码和登录密码必须一致",
                password2: "请输入一个正确的提现密码",
                repassword2: "确认提现密码和提现密码必须一致"
            },
        });
    })

</script>
{/block}